    var myChart = echarts.init(document.getElementById('main'));
    option = {
        legend: {data: "销量"},
        title: {
            text: '学院班级人数',
            x: 'center'
        },
        tooltip: {},
        xAxis: {data: []},

        yAxis: {},
        // Declare several bar series, each will be mapped
        // to a column of dataset.source by default.
        series: [
            {
                name: "人数",
                type: 'bar',
                data: []
            },

        ]
    };
    myChart.showLoading();
    myChart.setOption(option);
    var names = [];
    var nums = [];

    $.ajax({
        url: "/home/data",
        type: "GET",
        dataType: "json",
        success: function (data) {
            for (var i = 0; i < data.length; i++) {//循环json对象，拼接tr,td的htm
                names.push(data[i].name);
                nums.push(data[i].value);
            }
            myChart.hideLoading();
            myChart.setOption({        //加载数据图表
                xAxis: {
                    data: names,
                    axisLabel: {
                        rotate: 40
                    },
                },

                series: [{
                    name: '人数',
                    data: nums
                }]
            });
        },
        error: function () {
            alert("图表数据请求失败")
        }

    });
    var myChart1 = echarts.init(document.getElementById('ma'));
    option = {
        title: {
            text: '学院班级人数比例',
            x: 'center'
        },
        tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
        },
        legend: {
            orient: 'vertical',
            left: 'left',
        },
        series: [
            {
                type: 'pie',
                radius: '55%',
                center: ['50%', '60%'],

                data: [],
                itemStyle: {
                    emphasis: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    $.ajax({
        url: "/home/data",
        type: "GET",
        success: function (data) {

            myChart1.hideLoading();
            myChart1.setOption(option);
            myChart1.setOption({        //加载数据图
                series: [{
                    // 根据名字对应到相应的系列
                    name: '人数',
                    data: data
                }]
            });
        },
        error: function () {
            alert("图表数据查询失败")
        }

    });
